﻿@{
    ViewBag.Title = "UpHeader";
    Layout = "";
}
<script>
    $("#Button1").click(function () {
        $.ajaxFileUpload
                   (
                       {
                           url: '/Admin/UpFile?Path=userheader',
                           secureuri: false,
                           fileElementId: 'File1',
                           dataType: 'json',
                           success: function (data, status) {
                               if (typeof (data.error) != 'undefined') {
                                   if (data.error != '') {
                                       alert(data.error);
                                   } else {
                                       $.post("/User/SaveHeader",
                                       { Logo: data.msg },
                                       function (dataBack) {
                                           if (dataBack.Result) {
                                               location.reload();
                                           }
                                       });


                                   }
                               }
                           },
                           error: function (data, status, e) {
                               alert(e);
                           }
                       }
                   )




    })
</script>
<script type="text/javascript" src="/Scripts/ajaxfileupload/ajaxfileupload.js"></script>
<h2>上传头像</h2>
<input id="File1" name="File1" type="file" />
<input id="Button1" type="button" value="上传" />